Skip to content

生成含有外键的一对多表单的时候,主表单无法正确利用外键查找到子表单的数据 #8324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MagicMarvel opened this issue May 22, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@MagicMarvel
Copy link

版本号:

3.8.0 Vue3

问题描述:

我使用了自定义的外键生成一对多的表单后,我发现主表单没法正确利用外键查找子表单

且这个现象只有在代码生成的时候,才会出现,online表单没有这个问题

查看请求可知:选中主表的某一项,查询子表的时候,传递的是正确的我指定的外键字段,但是该字段的值被填成了主表ID

错误截图:

配置如下:

Image

Image

Image

现象:
功能测试时:

Image

我发现可以拿到子表对应的数据

代码生成后

Image

怀疑是在线表单和代码生成背后的代码不一致了,代码生成没有处理这种自定义外键的情况,但是在线表单处理了

友情提示:

  • 未按格式要求发帖、描述过于简单的,会被直接删掉;
  • 描述问题请图文并茂,方便我们理解并快速定位问题;
  • 如果使用的不是master,请说明你使用的分支;
@MagicMarvel MagicMarvel added the bug Something isn't working label May 22, 2025
@zhangdaiscott
Copy link
Member

@MagicMarvel
Copy link
Author

更改后仍然出现问题

Image

Image

Image

仍然没有获取到正确的外键的值,而是采用了主键ID进行查询

查看代码知:

Image

这里只能拿到主键的值,没法拿到某一行数据的指定外键的值

然后子表通过这个错误的值,获取到了错误的数据

Image

@zhangdaiscott
Copy link
Member

sq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants